﻿@using System.Web.Mvc
@using Webdiyer.WebControls.Mvc
@using KXCXW.Web.CommonClass
@using kxcxw.Data.Common
@model PagedList<kxcxw.Data.Entities.Activity>
@using KXCXW.Web.CommonClass;
@{
    kxcxw.Data.Common.CommonRepositories cr = new kxcxw.Data.Common.CommonRepositories();
}
<div id="dvOrders">
    <table>
        <tr>
            <th style="width: 7%">
                活动图片
            </th>
            <th style="width: 33%">
                标题
            </th>
            <th style="width: 15%">
                发布人
            </th>
            <th style="width: 15%">
                @Html.ActionLink("申请时间", "Index", new { sortOrder = ViewBag.DateSortParm })
            </th>
            <th style="width: 10%">
                状态
            </th>
            <th style="width: 20%">
                操作
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td style="padding-left: 5px;">
                    <a href="@item.ShopUrl" class="pic" target="_blank" title="@item.Title">
                        <img style="width:80px;" alt="" src="@Url.Content("~/Content/upload/Activity/img_135_90/" + item.ImageName)" />
                    </a>
                </td>
                <td>
                    @{string title = item.Title;
                      if (title.Length > 30)
                      {
                          title = title.Substring(0, 30) + "...";
                      }
                    }
                    @title
                </td>
                <td>
                    <span>@cr.getUserById(item.UserID).UserName</span>
                </td>
                <td>
                    @string.Format("{0:D}", DateTime.Parse(@Html.DisplayFor(modelItem => item.CreateDate).ToString()))
                </td>
                <td>
                    @if (item.Status == DataConstants.pending)
                    {
                        @("等待审核")
                    }
                    else if (item.Status == DataConstants.Normal)
                    {
                        @("通过审核") 
                    }
                    else if (item.Status == DataConstants.Illegal)
                    {
                        @("不符合标准") 
                    }
                    else if (item.Status == DataConstants.Deleted)
                    {
                        @("已删除") 
                    }
                </td>
                <td class="action">
                    @Html.ActionLink("查看", "Details", new { id = item.ActivityId }, new { @class = "view", target = "_blank" })
                    | <a href="javascript:void(0)" class="edit" id="@item.ActivityId">通过</a> | <a href="javascript:void(0)" class="delete" id="@item.ActivityId">
                        拒绝</a>
                </td>
            </tr>
        }
        <tr>
            <td colspan="7">
                共有 @Model.TotalItemCount 条记录 @Model.CurrentPageIndex/@Model.TotalPageCount
                @Html.Pager(
                 Model, new PagerOptions
                 {
                     PageIndexParameterName = "page",
                     FirstPageText = "首页",
                     LastPageText = "尾页",
                     NextPageText = "后一页",
                     PrevPageText = "前一页",
                     ShowPageIndexBox = true,
                     PageIndexBoxType = PageIndexBoxType.TextBox,
                     PageIndexBoxWrapperFormatString = "请输入页数{0}"
                 }, "Admin_default",
                    new { sortOrder = ViewBag.DateSortParm, searchString = ViewBag.Filter }
                    )
            </td>
        </tr>
    </table>
</div>
